Adding a Local Dependency with Pip

Adding a local dependency in Python projects can be easily done using pip, the package installer for Python. This method is particularly useful when you are developing a library and an application simultaneously and want to test changes in real-time.

DALL·E 2023-11-19 01.13.02 - A banner image for a Twitter post and article titled 'Adding a Local Dependency with Pip', featuring a digital, tech-themed design. The image should i.png

Steps to Add Local Dependency

  1. Navigate to Your Project Directory: Open a terminal and navigate to the directory of the project where you want to add the local dependency.

  2. Use Pip to Add Local Dependency:
    Run the following command, replacing path/to/local/library with the relative or absolute path to your local library directory.

    pip install -e path/to/local/library
    
  3. Editable Mode:
    The -e flag installs the package in "editable" mode. Any changes made to the local library will be immediately available in the project that added it as a dependency.

Benefits


本文作者:Maeiee

本文链接:Adding a Local Dependency with Pip

版权声明:如无特别声明,本文即为原创文章,版权归 Maeiee 所有,未经允许不得转载!


喜欢我文章的朋友请随缘打赏,鼓励我创作更多更好的作品!